package com.iteaj.network.test.client.line;

import com.iteaj.iot.client.TcpClientComponentAdapter;
import com.iteaj.network.AbstractProtocol;
import com.iteaj.network.codec.IotMessageDecoder;
import com.iteaj.network.codec.adapter.LineBasedFrameMessageDecoderAdapter;
import com.iteaj.network.config.ConnectProperties;

public class LineClientComponent extends TcpClientComponentAdapter<LineClientMessage> {

    public LineClientComponent(ConnectProperties config) {
        super(config);
    }

    @Override
    public String getName() {
        return "客户端换行符解码器测试";
    }

    @Override
    protected IotMessageDecoder getClientProtocolDecoder() {
        return new LineBasedFrameMessageDecoderAdapter(1024);
    }

    @Override
    public AbstractProtocol getProtocol(LineClientMessage message) {
        return remove(message.getMessageId());
    }
}
